package com.cskaoyan.javase.oop1._5this;

/**
 * this关键字经常用来在成员方法中,给成员变量赋值
 * 用来区分同名成员变量和局部变量
 *
 * @since 15:00
 * @author wuguidong@cskaoyan.onaliyun.com
 */
public class Demo2 {
    public static void main(String[] args) {
        A a = new A();
        System.out.println(a.num);
        a.setNum(1000);
        System.out.println(a.num);
    }
}

class A {
    int num;

    public void setNum(int num) {
        // 用方法的传参局部变量num给成员变量num赋值
        // num = num;
        this.num = num;
    }
}
